'''
	HeaDSET gives third party developers a simple way to modify the 
	instrument in the system. The developers of HeaDSET garantee that
	the api described in WrapperInterface will not change. 
	
	Using methods defined higher may mean future incompability. This is a
	versioned api. Minor updates are all compabtible in with their orginial
	Major version. Major version are not compabtible with each other.
	
	@author: J.H.Donker
	@copyright: Twente University
'''
from time import time

class WrapperInterface:
	'''
		Defines a simple instrument wrapper interface.
		
		@version: 1.0
	'''
	def __init__(self):
		'''
			Constructor for the interface.
			
			@version: 1.0
		'''
		pass
		
	def SetPositionInstrument(self, x, y, z):
		'''
			Sets the position of the instrument.
			
			@param x: x component
			@param y: y component
			@param z: z component
			
			@version: 1.0
		'''
		pass
		
	def SetOrientationInstrument(self, x,y, z):
		'''
			Sets the orientation of the instrument.
			
			@param x: x component
			@param y: y component
			@param z: z component
			
			@version: 1.0
		'''
		pass
		
	def SetScaleInstrument(self, x, y, z):
		'''
			Sets the scale of the instrument.
			
			@param x: x component.
			@param y: y component.
			@param z: z component.
			
			@version: 1.0
		'''
		pass
						
	def GetPositionInstrument(self):
		'''
			Gives the position of the instrument.
			
			@return: Returns a (x,y,z) tuple.
			
			@version: 1.0		
		'''
		return (0,0,0)
		
	def GetOrientationInstrument(self):
		'''
			Gives the orientation of the instrument.
			
			@return: Returns a (x,y,z) tuple.
			
			@version: 1.0		
		'''
		return (0,0,0)
		
	def GetScaleInstrument(self):
		'''
			Gives the scale of the instrument.
			
			@return: Returns a (x,y,z) tuple.
			
			@version: 1.0		
		'''
		return (0,0,0)


class InputWrapper(WrapperInterface):
	'''
		An implementation of the interface wrapper.
		
		 @version: 1.1 
	'''
	def __init__(self, model):
		WrapperInterface.__init__(self)
		self.__instrument = model.GetInstrument()

	def SetPositionInstrument(self, x, y, z):
		self.__instrument.SetPosition(x,y,z)
	
	
	def SetOrientationInstrument(self, x,y, z):
		self.__instrument.SetOrientation(x,y,z)
	

	def SetScaleInstrument(self, x, y, z):
		self.__instrument.SetScale(x,y,z)

		
	def GetPositionInstrument(self):
		return self.__instrument.GetPosition()

		
	def GetOrientationInstrument(self):
		return self.__instrument.GetOrientation()
	

	def GetScaleInstrument(self):
		return self.__instrument.GetScale()
	

	def BoxWidgetInstrument(self, value):
		'''
		Enables the boxwidget of the inteface. 
		
		@warning: This is here for the position instrument.
		@version 1.1 
		'''
		if value:
			self.__instrument.EnableBoxWidgets()
		else:
			self.__instrument.DisableBoxWidgets()
		